import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '名称',
    align:"center",
    dataIndex: 'mingc'
   },
   {
    title: '代码',
    align:"center",
    dataIndex: 'daim'
   },
   {
    title: '发布时间',
    align:"center",
    dataIndex: 'fabusj',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '开始时间',
    align:"center",
    dataIndex: 'kaissj',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '截止时间',
    align:"center",
    dataIndex: 'jiezsj',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '当前赛事进程',
    align:"center",
    dataIndex: 'dangqssjc_dictText'
   },
   {
    title: '进程说明',
    align:"center",
    dataIndex: 'jincsm'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "名称",
      field: 'mingc',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "当前赛事进程",
      field: 'dangqssjc',
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"cdba2_saisjc,jincmc,id"
      },
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '名称',
    field: 'mingc',
    component: 'Input',
  },
  {
    label: '代码',
    field: 'daim',
    component: 'Input',
  },
  {
    label: '参赛规程',
    field: 'cansgc',
    component: 'JEditor',
  },
  // {
  //   label: '大赛声明',
  //   field: 'dassm',
  //   component: 'JEditor',
  // },
  {
    label: '发布时间',
    field: 'fabusj',
    component: 'DatePicker',
  },
  {
    label: '开始时间',
    field: 'kaissj',
    component: 'DatePicker',
  },
  {
    label: '截止时间',
    field: 'jiezsj',
    component: 'DatePicker',
  },
  {
    label: '当前赛事进程',
    field: 'dangqssjc',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"cdba2_saisjc,jincmc,id"
     },
  },
  {
    label: '进程说明',
    field: 'jincsm',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  mingc: {title: '名称',order: 0,view: 'text', type: 'string',},
  daim: {title: '代码',order: 1,view: 'text', type: 'string',},
  fabusj: {title: '发布时间',order: 4,view: 'date', type: 'string',},
  kaissj: {title: '开始时间',order: 5,view: 'date', type: 'string',},
  jiezsj: {title: '截止时间',order: 6,view: 'date', type: 'string',},
  dangqssjc: {title: '当前赛事进程',order: 7,view: 'list', type: 'string',dictTable: "cdba2_saisjc", dictCode: 'id', dictText: 'jincmc',},
  jincsm: {title: '进程说明',order: 8,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
